package com.opgea.tutor.web.dto;

import com.opgea.tutor.domain.entities.Person;
import com.opgea.tutor.domain.entities.Tutor;
import com.opgea.tutor.domain.interfaces.Marshallable;

public class TutorDTO extends Person implements Marshallable<Tutor> {

    /**
     * 
     */
    private static final long serialVersionUID = -8431494738107451235L;
    private long id;
    private long loginIdPrimaryKey;

    public long getId() {
	return id;
    }

    public void setId(long id) {
	this.id = id;
    }

    public long getLoginIdPrimaryKey() {
	return loginIdPrimaryKey;
    }

    public void setLoginIdPrimaryKey(long loginIdPrimaryKey) {
	this.loginIdPrimaryKey = loginIdPrimaryKey;
    }

    @Override
    public void marshall(Tutor tutor) {
	if (tutor != null && tutor.getId() > 0) {
	    setId(tutor.getId());
	    setFirstName(tutor.getFirstName());
	    setMiddleName(tutor.getMiddleName());
	    setLastName(tutor.getLastName());
	    setTitle(tutor.getTitle());
	    setSex(tutor.getSex());
	    setDateOfBirth(tutor.getDateOfBirth());
	    setEmailIds(tutor.getEmailIds());
	    setPhoneNumbers(tutor.getPhoneNumbers());
	}
    }

    @Override
    public Tutor unmarshall(Tutor tutor) {
	if (this.getId() > 0 && tutor != null) {
	    tutor.setId(this.getId());
	    tutor.setFirstName(this.getFirstName());
	    tutor.setMiddleName(this.getMiddleName());
	    tutor.setLastName(this.getLastName());
	    tutor.setTitle(this.getTitle());
	    tutor.setSex(this.getSex());
	    tutor.setDateOfBirth(this.getDateOfBirth());
	    tutor.setEmailIds(this.getEmailIds());
	    tutor.setPhoneNumbers(this.getPhoneNumbers());
	}
	return tutor;
    }

    @Override
    public String toString() {
	return "TutorDTO [id=" + id + ", loginIdPrimaryKey="
		+ loginIdPrimaryKey + "]";
    }

}
